package cu.tedu.egmybatis2.mapper;

import cu.tedu.egmybatis2.pojo.entity.Customer;
import cu.tedu.egmybatis2.pojo.vo.CustomersVO1;
import cu.tedu.egmybatis2.pojo.vo.CustomersVO2;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.awt.*;
import java.util.List;

@Mapper
public interface CustomerMapper {
    @Insert("INSERT INTO customers (cust_id,cust_tel,cust_name,address) VALUES (#{custId},#{custTel},#{custName},#{address})")
    int insertCustomer(Customer customer);


    @Select("SELECT cust_name custName,cust_tel custTel FROM customers WHERE cust_id=#{custId}")
    CustomersVO1 selectSingleCustomer(int custId);

    @Select("SELECT cust_name custName,address FROM customers WHERE address='北京'")
    List<CustomersVO2> selectManyCustomer();

}
